From: Sebastian Wick Date: Tue, 16 Apr 2024 14:29:48 +0000 (+0200) Subject: shell-util: Only use systemd if gnome-shell is managed by systemd X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~226^2^2~201 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=b3580919e3982477461e8918698a98788fabe353;p=gnome-shell.git shell-util: Only use systemd if gnome-shell is managed by systemd Simply looking at the return value of sd_pid_get_user_unit can be used to determine if the process is in a systemd unit, but it doesn't say if gnome-shell is managed by systemd. For example, running toolbx on a host with systemd creates a libpod unit, even if the gnome-shell that gets started in the toolbx is itself not managed by systemd. We can make sure that gnome-shell is managed by systemd simply by checking if the unit we're running starts with org.gnome.Shell. Part-of: --- diff --git a/src/shell-util.c b/src/shell-util.c index 3f91d547d..00e3aa16c 100644 --- a/src/shell-util.c +++ b/src/shell-util.c @@ -635,7 +635,8 @@ shell_util_systemd_call (const char *command, */ res = sd_pid_get_user_unit (getpid (), &self_unit); - if (res == -ENODATA) + if (res == -ENODATA || + (res >= 0 && !g_str_has_prefix (self_unit, "org.gnome.Shell"))) { g_task_return_new_error (task, G_IO_ERROR,